home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.alaska-software.com
/
2014.06.ftp.alaska-software.com.tar
/
ftp.alaska-software.com
/
3pp
/
mxsetup.old
/
{app}
/
MxRegVal.prg
< prev
next >
Wrap
Text File
|
2001-09-28
|
2KB
|
77 lines
//////////////////////////////////////////////////////////////////////
//
// MxRegVal.prg
//
// Copyright:
// Maniacc Software Inc., (c) 1999. All rights reserved.
//
// Contents:
// Retrieves values from the Registry using Thomas Braun's RegClass
// - MxGetFont() --> cFontCompoundName (complete with point size)
// ie: "10.MS Sans Serif Bold"
//
//////////////////////////////////////////////////////////////////////
#include "regclass.ch"
#include "xbp.ch"
#include "nls.ch"
FUNCTION MxGetFont( cWinFont )
LOCAL oReg
LOCAL nPtSize, nSkip, nName, i
LOCAL cRegFont, cFontCompoundName
LOCAL aFontTypes := {"CaptionFont","SmCaptionFont","MenuFont","StatusFont","MessageFont","IconFont"}
cWinFont := iif(!empty(cWinFont),cWinFont,aFontTypes[5])
// can be "CaptionFont" or 1
// "SmCaptionFont" or 2
// "MenuFont" or 3
// "StatusFont" or 4
// "MessageFont" or 5
// "IconFont" or 6
if valtype(cWinFont)=="N"
cWinFont := aFontTypes[cWinFont]
endif
oReg := XbpReg():NEW( "HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics" )
if ! oReg:Status()
oReg:Create()
endif
oReg:ReadBinType("C")
cRegFont := oReg:GetValue( cWinFont ) // Get the entire String from the Registry
nPtSize := Bin2i( cRegFont )
if len(cRegFont) > 60
nSkip := 2
nPtSize := round(abs(0.75*nPtSize),0)
else
nSkip := 1
endif
cFontCompoundName := alltrim(str(nPtSize))+"."
i := 1+(10*nSkip)+8
do while i<=len(cRegFont) .and. asc(cRegFont[i])<>0
cFontCompoundName := cFontCompoundName+cRegFont[i]
i := i+nSkip
enddo
cFontCompoundName := iif(Bin2i(subStr(cRegFont,1+(8*nSkip),2))>=XBPFONT_WEIGHT_BOLD,;
cFontCompoundName+" Bold",;
cFontCompoundName)
cFontCompoundName := iif(asc(cRegFont[1+(10*nSkip)])==1,;
cFontCompoundName+" Italic",;
cFontCompoundName)
// If the following is true, the display should be Russian (codepage 204)
cFontCompoundName := iif(asc(cRegFont[1+(13*nSkip)])==204,;
cFontCompoundName+" (Cyrillic)",;
cFontCompoundName)
if asc(cRegFont[1+(13*nSkip)])==204
// setLocale(NLS_IOEMCP,"204")
endif
RETURN cFontCompoundName